package br.inf.mensageiro.socket;

import java.io.IOException;
import java.net.Socket;

import javax.net.ssl.SSLServerSocket;
import javax.net.ssl.SSLServerSocketFactory;

import br.inf.mensageiro.util.Parametro;

public class ServerSocket implements Runnable{	
	
	private SSLServerSocketFactory sslssf=(SSLServerSocketFactory)SSLServerSocketFactory.getDefault();

	public void run() {
		try{
			SSLServerSocket ss=(SSLServerSocket)sslssf.createServerSocket(Parametro.PORT_SERVER);
			final String[] enabledCipherSuites = { "SSL_DH_anon_WITH_RC4_128_MD5" };
			ss.setEnabledCipherSuites(enabledCipherSuites);			
			while(true){
				Socket s=ss.accept();
				Thread t=new Thread(new SocketHandler(s));
				t.start();
			}
		}catch(IOException ioe){
			ioe.printStackTrace();
		}
	}

}
